<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>练习</title>
</head>
<body>
<div>
  <input type="text" placeholder="请输入0-100之间的整数" v-model="ii">
  <input type="button" value="猜一猜" @click="f()">
  <h1>结果:{{info}}</h1>
</div>
<script src="../js/vue.js"></script>
<script>
    let s = parseInt(Math.random()*101)
    let v = new Vue({
        el:"div",
        data:{info:"",
        ii :""},
        methods:{
            f() {
                if(v.ii == s) {
                    v.info = "恭喜你，猜对了"
                }else if(v.ii > s) {
                    v.info = "猜大了"
                }else{
                    v.info = "猜小了"
                }
            }
        }
    })
</script>
</body>
</html>